package com.dxy.lc.socketio.handler;

import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.listener.ExceptionListener;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class LcOnSocketIoErrorHandler implements ExceptionListener {

    @Override
    public void onEventException(Exception e, List<Object> args, SocketIOClient client) {
        log.error("socketio-onEventException: ", e);
    }

    @Override
    public void onDisconnectException(Exception e, SocketIOClient client) {
        log.error("socketio-onDisconnectException: ", e);
    }

    @Override
    public void onConnectException(Exception e, SocketIOClient client) {
        log.error("socketio-onConnectException: ", e);
    }

    @Override
    public void onPingException(Exception e, SocketIOClient client) {
        log.error("socketio-onPingException: ", e);
    }

    @Override
    public void onPongException(Exception e, SocketIOClient client) {
        log.error("socketio-onPongException: ", e);
    }

    @Override
    public boolean exceptionCaught(ChannelHandlerContext ctx, Throwable e) throws Exception {
        return false;
    }
}
